﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using TiaoTaoHelper.Wtm.Units.EFCore;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 需求池关联信息变更 : TransactionalMigration
    {
        /// <inheritdoc />
        protected override void UpWithTransaction(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "SysPurchaseRequirementPoolManager",
                columns: table => new
                {
                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PurchaseRequirementPoolId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ManagerId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SysPurchaseRequirementPoolManager", x => x.ID);
                    table.ForeignKey(
                        name: "FK_SysPurchaseRequirementPoolManager_FrameworkUsers_ManagerId",
                        column: x => x.ManagerId,
                        principalTable: "FrameworkUsers",
                        principalColumn: "ID");
                    table.ForeignKey(
                        name: "FK_SysPurchaseRequirementPoolManager_SysPurchaseRequirementPool_PurchaseRequirementPoolId",
                        column: x => x.PurchaseRequirementPoolId,
                        principalTable: "SysPurchaseRequirementPool",
                        principalColumn: "ID");
                });

            migrationBuilder.CreateIndex(
                name: "IX_SysPurchaseRequirementPoolManager_ManagerId",
                table: "SysPurchaseRequirementPoolManager",
                column: "ManagerId");

            migrationBuilder.CreateIndex(
                name: "IX_SysPurchaseRequirementPoolManager_PurchaseRequirementPoolId",
                table: "SysPurchaseRequirementPoolManager",
                column: "PurchaseRequirementPoolId");
        }

        /// <inheritdoc />
        protected override void DownWithTransaction(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "SysPurchaseRequirementPoolManager");
        }

    }
}
